home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 November / PCWNOV08.iso / Software / Freeware / Mini Map Sidebar 0.3 / mini_map_sidebar-0.3.0-fx.xpi / chrome / content / embedKml.js < prev    next >
Encoding:
JavaScript  |  2008-02-18  |  1.3 KB  |  29 lines

  1. var $ = function(x) { return  document.getElementById(x); };
  2. var gUrl;
  3.  
  4. function embedInit(){
  5.     var params = window.arguments[0];
  6.     gUrl = params.url;
  7.     var title = params.title;
  8.     $('embed-title').setAttribute('value',title);
  9.     var source = "http://maps.stcstm.org/geoxml?url="+gUrl+"&type=m";
  10.     var iframecode = '<iframe src="'+source+'" width="400" height="300" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" />'; 
  11.     $('minimap-embed-code').setAttribute('value',iframecode);
  12.     var body = $('minimap-embed-iframe').contentWindow.document.getElementsByTagName('body')[0];
  13.     body.innerHTML = '<div width="100%" height="100%" align="center">'+iframecode+'</div>';
  14. }
  15.  
  16. function embedRefresh(){
  17.     var mt = $('minimap-embed-maptype').value;
  18.     var title = $('embed-title').value;
  19.     var w = $('minimap-embed-width').value;
  20.     var h = $('minimap-embed-height').value;
  21.     var source = "http://maps.stcstm.org/geoxml?url="+gUrl+"&type="+mt;
  22.     var iframecode = '<iframe src="'+source+'" width="'+w+'" height="'+h+'" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" />'; 
  23.     var body = $('minimap-embed-iframe').contentWindow.document.getElementsByTagName('body')[0];
  24.     body.innerHTML = '<div width="100%" height="100%" align="center">'+iframecode+'</div>';
  25. }
  26.  
  27.  
  28.  
  29.